// min-sql
$(function() {
    $.ajax({
        type: "get",
        url: "../lib/getall2.php",
        dataType: "json",
        success: function(data) {
            let temp = '';
            data.forEach((elm, i) => {
                let pic = JSON.parse(elm.pic);
                temp += `
                <li>
                    <a href="product.html?id=${elm.id}" target="_blank">
                        <img src="..${pic[0].src}" alt="">
                        <span>${elm.title} </span>
                    </a>
                </li>
                `;
            });
            $('.list2').append(temp)
        }
    });

    $.ajax({
        type: "get",
        url: "../lib/getall3.php",
        dataType: "json",
        success: function(data) {
            let temp = '';
            data.forEach((elm, i) => {
                let pic = JSON.parse(elm.pic);
                temp += `
                <li>
                    <a href="product.html?id=${elm.id}" target="_blank">
                        <img src="..${pic[0].src}" alt="">
                        <span>${elm.title} </span>
                    </a>
                </li>
                `;
            });
            $('.list3').append(temp)
        }
    });

    $.ajax({
        type: "get",
        url: "../lib/getall4.php",
        dataType: "json",
        success: function(data) {
            let temp = '';
            data.forEach((elm, i) => {
                let pic = JSON.parse(elm.pic);
                temp += `
                <li>
                    <a href="product.html?id=${elm.id}" target="_blank">
                        <img src="..${pic[0].src}" alt="">
                        <span>${elm.title} </span>
                    </a>
                </li>
                `;
            });
            $('.list4').append(temp)
        }
    });

    $.ajax({
        type: "get",
        url: "../lib/getall5.php",
        dataType: "json",
        success: function(data) {
            let temp = '';
            data.forEach((elm, i) => {
                let pic = JSON.parse(elm.pic);
                temp += `
                <li>
                    <a href="product.html?id=${elm.id}" target="_blank">
                        <img src="..${pic[0].src}" alt="">
                        <span>${elm.title} </span>
                    </a>
                </li>
                `;
            });
            $('.list5').append(temp)
        }
    });
})